<!-- 新增与编辑门店 -->
<template>
  <el-dialog :title="dialog.title" :visible.sync="dialog.show" width="530px" height="400px" custom-class="mydialog" append-to-body @close="handleClose">
    <div class="dialog-content">
      <el-form ref="formsku" :model="form" :rules="rules" label-width="150px" >
        <el-form-item label="分类：" >
          <el-select v-model="form.type" placeholder="" class="seach-select" size="small">
            <el-option v-for="item in form.type_options" :key="item.value" :label="item.label" :value="item.value"/>
          </el-select>
        </el-form-item>
        <el-form-item label="品类：" >
          <el-select v-model="form.cate" placeholder="" class="seach-select" size="small">
            <el-option v-for="item in form.cate_options" :key="item.value" :label="item.label" :value="item.value"/>
          </el-select>
        </el-form-item>
        <el-form-item label="品牌：" >
          <el-select v-model="form.card" placeholder="" class="seach-select" size="small">
            <el-option v-for="item in form.card_options" :key="item.value" :label="item.label" :value="item.value"/>
          </el-select>
        </el-form-item>
        <el-form-item label="SKU名称：" >
          <el-input v-model="form.name" />
        </el-form-item>
        <el-form-item label="出货方式：" >
          <el-select v-model="form.paking" placeholder="" class="seach-select" size="small">
            <el-option v-for="item in form.paking_options" :key="item.value" :label="item.label" :value="item.value"/>
          </el-select>
        </el-form-item>
        <el-form-item label="供应商：" >
          <el-select v-model="form.person" placeholder="" class="seach-select" size="small">
            <el-option v-for="item in form.person_options" :key="item.value" :label="item.label" :value="item.value"/>
          </el-select>
        </el-form-item>
        <el-form-item label="国际条码：" >
          <el-input v-model="form.interCode"/>
        </el-form-item>
        <el-form-item label="商城成本价：" >
          <el-input v-model="form.price"/>
        </el-form-item>
        <el-form-item label="服务星号：" >
          <el-input v-model="form.start"/>
        </el-form-item>
        <el-form-item prop="type" label="状态：" >
          <el-select v-model="form.status" placeholder="" class="seach-select" size="small">
            <el-option v-for="item in form.status_options" :key="item.value" :label="item.label" :value="item.value"/>
          </el-select>
        </el-form-item>
      </el-form>
      <div class="text-center mt-30">
        <el-button class="greenbt bt-wd" type="primary" @click="saveFun('formsku')">保存</el-button>
      </div>
    </div>
  </el-dialog>
</template>
<script>
export default{
  props: {
    // 父组件调用时传进来的参数
    modalData: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      dialog: {
        title: '', show: true
      },
      form: {
        type: '', type_options: [], cate: '', cate_options: [],
        card: '', card_options: [], name: '', paking: '', paking_options: [],
        person: '', person_options: [], interCode: '', price: '', start: '',
        status: '', status_options: []
      },
      rules: {
      }

    }
  },
  methods: {
    handleClose() {
      this.$emit('close')
    },
    saveFun(formName) {
      const self = this
      self.$refs[formName].validate((valid) => {
        if (valid) {
          //
        } else {
          return false
        }
      })
    }
  }
}
</script>
